home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacMETH 3.2.1 / MacMETH Manual 1992 / Manual Examples / InlineDemo.MOD < prev    next >
Encoding:
Text File  |  1992-10-09  |  793 b   |  32 lines  |  [TEXT/MEDT]

  1.     MODULE InlineDemo;  (* H. Seiler, 15-Mar-87 *)
  2.  
  3.     FROM SYSTEM IMPORT ADDRESS, INLINE, REG, SETREG;
  4.  
  5.         PROCEDURE InlineDemo1(p, q: LONGINT) : LONGINT;
  6.             (* demonstrates the access to parameters and the function result *)
  7.             (* without explicit knowlegde of the offsets produced by the compiler. *)
  8.         CONST D0 = 0; D1 = 1;
  9.         BEGIN
  10.             SETREG(D0, p);
  11.             SETREG(D1, q);
  12.             INLINE(4680H, 4681H, 8081H);
  13.             RETURN REG(D0)
  14.         END InlineDemo1;
  15.  
  16.  
  17.         PROCEDURE InlineDemo2(p, q: ADDRESS) : LONGINT;
  18.             (* copy the bytes from p^ to q^ until a zero-byte is *)
  19.             (* found and return the number of bytes copied. *)
  20.         CONST D0 = 0; A0 = 8; A1 = 9;
  21.         BEGIN
  22.             SETREG(A0, p);
  23.             SETREG(A1, q); 
  24.             SETREG(D0, REG(A0));
  25.             INLINE(12D8H, 66FCH);
  26.             RETURN REG(A0) - REG(D0)
  27.         END InlineDemo2;
  28.  
  29.     END InlineDemo.
  30.  
  31.  
  32.